import os
import settings
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
    (r'',          include('main.urls')),
    (r'',          include('social_auth.urls')),
    (r'^admin/',   include(admin.site.urls)),
    (r'^api/',     include('api.views')),
    (r'^profile/', include('profile.views')),
    (r'^cart/',    include('cart.views')),
    (r'^product/', include('product.views')),
)

if settings.LOCAL:
    urlpatterns += patterns('',
        url(r'^img/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': os.path.join(os.path.dirname(os.path.abspath(__file__)), 'media', 'img'),
        }),
        url(r'^src/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': os.path.join(os.path.dirname(os.path.abspath(__file__)), 'media', 'src'),
        }),
        url(r'^css/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': os.path.join(os.path.dirname(os.path.abspath(__file__)), 'media', 'css'),
        }),
    )
